package com.zlzxm.shoesmarket.viewmodel;

import android.util.Log;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.zlzxm.shoesmarket.R;
import com.zlzxm.shoesmarket.view.adapter.entity.EntityStatisticInfo;
import com.zlzxm.shoesmarket.view.adapter.entity.EntityStatisticMenu;

import java.util.ArrayList;
import java.util.List;

/**
 * CREATE BY zlzxm ON 4/9/21
 */
public class VMStatistic extends ViewModel {

    private static final String TAG = "VMStatistic";

    private MutableLiveData<List<EntityStatisticInfo>> liveInfo = new MutableLiveData<>();

    private MutableLiveData<List<EntityStatisticMenu>> liveMenu = new MutableLiveData<>();

    public MutableLiveData<List<EntityStatisticInfo>> getLiveInfo() {
        return liveInfo;
    }

    public MutableLiveData<List<EntityStatisticMenu>> getLiveMenu() {
        return liveMenu;
    }

    public VMStatistic() {
        Log.e(TAG,"VMStatistic构造");
        liveInfo.setValue(createInfo());
        liveMenu.setValue(createMenu());
    }


    //<editor-fold defaultState="collapsed" desc="私有方法">



    private List<EntityStatisticMenu> createMenu(){

        List<EntityStatisticMenu> menus = new ArrayList<>();

        menus.add(new EntityStatisticMenu(0, R.drawable.icon_statistic_menu_desc,EntityStatisticMenu.TITLE_DESC));
        menus.add(new EntityStatisticMenu(0, R.drawable.icon_statistic_menu_pic,EntityStatisticMenu.TITLE_PIC));
        menus.add(new EntityStatisticMenu(0, R.drawable.icon_statistic_menu_note,EntityStatisticMenu.TITLE_NOTE));
        menus.add(new EntityStatisticMenu(0, R.drawable.icon_statistic_menu_total,EntityStatisticMenu.TITLE_TOTAL));
        menus.add(new EntityStatisticMenu(0, R.drawable.icon_statistic_menu_in,EntityStatisticMenu.TITLE_IN));
        menus.add(new EntityStatisticMenu(0, R.drawable.icon_statistic_menu_out,EntityStatisticMenu.TITLE_OUT));


        return menus;
        
    }


    private List<EntityStatisticInfo> createInfo(){


        return  createInfo(null,null,null,null,null,null,
                null,null,null,null,
                null,null);
    }


    private List<EntityStatisticInfo> createInfo(String sort,String num,String cost,String total,
                                                 String profit,String sale,String realProfit,String profitRate,
                                                 String daySale,String dayProfit,String monthSale,String monthProfit){


        List<EntityStatisticInfo> list = new ArrayList<>();

        list.add(new EntityStatisticInfo(EntityStatisticInfo.SORT,sort));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.NUM,num));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.COST,cost));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.TOTAL,total));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.PROFIT,profit));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.SALE,sale));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.REAL_PROFIT,realProfit));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.PROFIT_RATE,profitRate));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.DAY_SALE,daySale));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.DAY_PROFIT,dayProfit));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.MONTH_SALE,monthSale));
        list.add(new EntityStatisticInfo(EntityStatisticInfo.MONTH_PROFIT,monthProfit));

        return  list;

    }


    // </editor-fold>


    //<editor-fold defaultState="collapsed" desc="测试">



    // </editor-fold>

}
